package robber;

import configuration.RobConfiguration;
import mysql.MysqlUtil;
import user.IUser;

/**
 * 管理Robber者工具类
 */
public class RobberUtil {

    /**
     * 开始狂暴抢课
     */
    public static void startCrazyRob(IUser user, AbstractRobber robber) {
        try {
            RobConfiguration.isCrazyRobMode = true;
            MysqlUtil.loadAbstractRobberData(robber, user.getUsername());/**数据库中初始化抢课资源*/
            robber.startCrazyRob();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 开始默认抢课
     */
    public static void startRob(IUser user, AbstractRobber robber) {
        try {
            RobConfiguration.isCrazyRobMode = false;
            MysqlUtil.loadAbstractRobberData(robber, user.getUsername());
            robber.startRob();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
